package com.senven.permission.controller;

import com.senven.permission.service.PermissionService;
import com.senven.common.pojo.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @BelongsProject: senven-orderfood-parent
 * @BelongsPackage: com.senven.permission.controller
 * @unthor : YSH
 * @date : 2022/8/29 21:34
 */
@RestController
@RequestMapping("permission/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("/leftPermission")
    public CommonResult leftPermission(HttpServletRequest request){
        String token = request.getHeader("token");
        return permissionService.selectLeftPermission(token);
    }

    @GetMapping("findPermissionByRoleId")
    public CommonResult findPermissionByRoleId(Integer roleId){
        System.out.println(roleId);
        return permissionService.findPermissionByRoleId(roleId);
    }
}
